package com.atguigu.sugar.mapper;

import com.atguigu.sugar.bean.KW;
import com.atguigu.sugar.bean.TrafficUvCt;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @auther yuzehua
 * @date 2022/10/27 - 16:09
 */
public interface TrafficMapper {
    @Select("select\n" +
            "    keyword,\n" +
            "    count(keyword_count) as score\n" +
            "from dws_traffic_keyword_page_view_window\n" +
            "where toYYYYMMDD(stt) = #{date}\n" +
            "group by keyword")
    List<KW> kw(int date);

    @Select("select\n" +
            "    ch,\n" +
            "    sum(uv_ct) uvCt\n" +
            "from dws_traffic_ch_page_view_window\n" +
            "where toYYYYMMDD(stt) = #{date}\n" +
            "group by toYYYYMMDD(stt),ch\n" +
            "order by uvCt desc ;")
    List<TrafficUvCt> selectUvCt(Integer date);
}
